package com.lxh.lxhcrm.model.pojos;

import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

/**
 * 开发团队 ：lxh
 * @author ：鞠玮
 * 开发时间 ：2020/1/9 10:21
 * 类的名称 ：Contract
 * 类的描述 ：合同表
 */
@Entity
@DynamicUpdate
public class Contract {
    private int contractId;
    private String theme;
    private Long contractNum;
    private Double totalMoney;
    private Date startTime;
    private Date overTime;
    private double invoiceMoney;
    private String customerSigner;
    private Date signTime;
    private Double returnMoney;
    private Double profit;
    private String conFilesUrl;
    /** 产品清单 */
    private List<ProductList> productList;
    /** 客户 */
    private Customer customer;
    /** 机会 */
    private Opportunity oppo;
    /** 合同分类 */
    private ConClassify classify;
    /** 付款方式 */
    private PaymentMethod paymentMethod;
    /** 交付方式 */
    private DeliveryMethod deliveryMethod;
    /** 我方签约人 */
    private Emp empSigner;
    /** 所有者 */
    private Emp owner;
    /** 结款方式 */
    private PayMethod payMethod;
    /** 合同状态 */
    private ConState conState;

    @ManyToOne
    @JoinColumn(name = "state", referencedColumnName = "_id")
    public ConState getConState() {
        return conState;
    }

    public void setConState(ConState conState) {
        this.conState = conState;
    }

    @ManyToOne
    @JoinColumn(name = "customer_id", referencedColumnName = "customer_id")
    public Customer getCustomer() {
        return customer;
    }

    public void setCustomer(Customer customer) {
        this.customer = customer;
    }

    @ManyToOne
    @JoinColumn(name = "oppo_id", referencedColumnName = "oppo_id")
    public Opportunity getOppo() {
        return oppo;
    }

    public void setOppo(Opportunity oppo) {
        this.oppo = oppo;
    }

    @ManyToOne
    @JoinColumn(name = "classify_id")
    public ConClassify getClassify() {
        return classify;
    }

    public void setClassify(ConClassify classify) {
        this.classify = classify;
    }

    @ManyToOne
    @JoinColumn(name = "payment_method_id", referencedColumnName = "_id")
    public PaymentMethod getPaymentMethod() {
        return paymentMethod;
    }

    public void setPaymentMethod(PaymentMethod paymentMethod) {
        this.paymentMethod = paymentMethod;
    }

    @ManyToOne
    @JoinColumn(name = "delivery_method_id", referencedColumnName = "delivery_method_id")
    public DeliveryMethod getDeliveryMethod() {
        return deliveryMethod;
    }

    public void setDeliveryMethod(DeliveryMethod deliveryMethod) {
        this.deliveryMethod = deliveryMethod;
    }

    @ManyToOne
    @JoinColumn(name = "emp_signer")
    public Emp getEmpSigner() {
        return empSigner;
    }

    public void setEmpSigner(Emp empSigner) {
        this.empSigner = empSigner;
    }

    @ManyToOne
    @JoinColumn(name = "emp_id", referencedColumnName = "emp_id")
    public Emp getOwner() {
        return owner;
    }

    public void setOwner(Emp owner) {
        this.owner = owner;
    }

    @ManyToOne
    @JoinColumn(name = "pay_method_id", referencedColumnName = "_id")
    public PayMethod getPayMethod() {
        return payMethod;
    }

    public void setPayMethod(PayMethod payMethod) {
        this.payMethod = payMethod;
    }

    @OneToMany(mappedBy = "contract")
    public List<ProductList> getProductList() {
        return productList;
    }

    public void setProductList(List<ProductList> productList) {
        this.productList = productList;
    }

    @Id
    @Column(name = "contract_id", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public int getContractId() {
        return contractId;
    }

    public void setContractId(int contractId) {
        this.contractId = contractId;
    }

    @Basic
    @Column(name = "theme", nullable = true, length = 255)
    public String getTheme() {
        return theme;
    }

    public void setTheme(String theme) {
        this.theme = theme;
    }

    @Basic
    @Column(name = "contract_num", nullable = true)
    public Long getContractNum() {
        return contractNum;
    }

    public void setContractNum(Long contractNum) {
        this.contractNum = contractNum;
    }

    @Basic
    @Column(name = "total_money", nullable = true, precision = 0)
    public Double getTotalMoney() {
        return totalMoney;
    }

    public void setTotalMoney(Double totalMoney) {
        this.totalMoney = totalMoney;
    }

    @Basic
    @Column(name = "start_time", nullable = true)
    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    @Basic
    @Column(name = "over_time", nullable = true)
    public Date getOverTime() {
        return overTime;
    }

    public void setOverTime(Date overTime) {
        this.overTime = overTime;
    }

    @Basic
    @Column(name = "invoice_money", nullable = true)
    public double getInvoiceMoney() {
        return invoiceMoney;
    }

    public void setInvoiceMoney(double invoiceMoney) {
        this.invoiceMoney = invoiceMoney;
    }

    @Basic
    @Column(name = "customer_signer", nullable = true, length = 40)
    public String getCustomerSigner() {
        return customerSigner;
    }

    public void setCustomerSigner(String customerSigner) {
        this.customerSigner = customerSigner;
    }

    @Basic
    @Column(name = "sign_time", nullable = true)
    public Date getSignTime() {
        return signTime;
    }

    public void setSignTime(Date signTime) {
        this.signTime = signTime;
    }

    @Basic
    @Column(name = "return_money", nullable = true, precision = 0)
    public Double getReturnMoney() {
        return returnMoney;
    }

    public void setReturnMoney(Double returnMoney) {
        this.returnMoney = returnMoney;
    }

    @Basic
    @Column(name = "profit", nullable = true, precision = 0)
    public Double getProfit() {
        return profit;
    }

    public void setProfit(Double profit) {
        this.profit = profit;
    }
    @Basic
    @Column(name = "con_files_url", nullable = true, precision = 0)
    public String getConFilesUrl() {
        return conFilesUrl;
    }

    public void setConFilesUrl(String conFilesUrl) {
        this.conFilesUrl = conFilesUrl;
    }

    @Override
    public String toString() {
        return "Contract{" +
                "contractId=" + contractId +
                ", theme='" + theme + '\'' +
                ", contractNum=" + contractNum +
                ", totalMoney=" + totalMoney +
                ", startTime=" + startTime +
                ", overTime=" + overTime +
                ", invoiceMoney=" + invoiceMoney +
                ", customerSigner='" + customerSigner + '\'' +
                ", signTime=" + signTime +
                ", returnMoney=" + returnMoney +
                ", profit=" + profit +
                ", conFilesUrl='" + conFilesUrl + '\'' +
                ", productList=" + productList +
                ", customer=" + customer +
                ", oppo=" + oppo +
                ", classify=" + classify +
                ", paymentMethod=" + paymentMethod +
                ", deliveryMethod=" + deliveryMethod +
                ", empSigner=" + empSigner +
                ", owner=" + owner +
                ", payMethod=" + payMethod +
                ", conState=" + conState +
                '}';
    }
}
